package com.markus.code.图.图1;

import java.util.Map;

/**
 * Author:markusZhang
 * Date:Create in 2020/8/19 17:48
 * todo: 测试迪杰斯特拉算法
 */
public class TestDijkstraDemo {
    public static void main(String[] args) {
        int [][]matrix = {{100,1,2},{2,1,3},{100,1,4},{3,3,2},{500,3,4},{200,2,5}};
        Graph graph = GraphGenerator.createGraph(matrix);
        GraphDijkstra graphDijkstra = new GraphDijkstra();
        Map<Node, Integer> dijkstra = graphDijkstra.dijkstra(graph, graph.nodes.get(1));
        for (Map.Entry<Integer,Node> entry : graph.nodes.entrySet()){
            Node value = entry.getValue();
            System.out.println(graph.nodes.get(1).value+"节点与"+value.value+"节点的最短距离是："+dijkstra.get(value));
        }
    }
}
